package org.springblade.modules.repair.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Date 10:31 2024/5/23
 * @Description {
 *   电梯停梯类型
 * }
 * @Author lsay
 **/
@Getter
@AllArgsConstructor
public enum ElevatorStopTypeEnum {

	/**
	 * 对应数据库表里面的type_status字段
	 */
	ELEVATOR_MAINTAIN(2, "设备维护"),
	ELEVATOR_MALFUNCTION(1, "设备故障"),
	ELEVATOR_NON_FAULT(3, "非设备故障");
	final int id;
	final String name;
	public static String getName(int id){
		ElevatorStopTypeEnum[] enums = ElevatorStopTypeEnum.values();
		for (ElevatorStopTypeEnum typeEnum : enums) {
			if(typeEnum.getId() == id){
				return typeEnum.getName();
			}
		}
		return null;
	}

	public static String getNameByPlanType(int typeStatus){
		if(typeStatus == MaintainPlanContentEnum.MAINTAIN_BY.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_AFFAIR.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_CHECK.getId()){
			return ELEVATOR_MAINTAIN.name;
		}else if(typeStatus == MaintainPlanContentEnum.MAINTAIN_WX.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_KR.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_PARTS.getId()){
			return ELEVATOR_MALFUNCTION.name;
		}else {
			return ELEVATOR_NON_FAULT.name;
		}
	}

	public static Integer getIdByPlanType(int typeStatus){
		if(typeStatus == MaintainPlanContentEnum.MAINTAIN_BY.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_AFFAIR.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_CHECK.getId()){
			return ELEVATOR_MAINTAIN.id;
		}else if(typeStatus == MaintainPlanContentEnum.MAINTAIN_WX.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_KR.getId()
			|| typeStatus == MaintainPlanContentEnum.MAINTAIN_PARTS.getId()){
			return ELEVATOR_MALFUNCTION.id;
		}else {
			return ELEVATOR_NON_FAULT.id;
		}
	}

}
